package com.livesource.client.utilities;

public class FileExtensions {

	public static String EXTENSION_FEATURE = "feature";
	public static String EXTENSION_JAVA = "java";
	public static String EXTENSION_JSP = "jsp";
	public static String EXTENSION_JS = "js";
	public static String EXTENSION_CSS = "css";
	public static String EXTENSION_HTML = "html";
	public static String EXTENSION_XML = "xml";
	public static String EXTENSION_TXT = "txt";

	public static String EXTENSION_JAR = "jar";
	public static String EXTENSION_JPG = "jpg";
	public static String EXTENSION_GIF = "gif";
	public static String EXTENSION_PNG = "png";

	public static String getFileExtension(String fileName) {

		String extension = "";

		String[] names = fileName.split("\\.");

		if (names.length > 0) {

			extension = names[names.length - 1];
		}

		return extension;
	}

	public static boolean isTextFile(String fileExtension) {

		if (EXTENSION_JAR.equals(fileExtension)
				|| EXTENSION_JPG.equals(fileExtension)
				|| EXTENSION_GIF.equals(fileExtension)
				|| EXTENSION_PNG.equals(fileExtension)) {

			return false;
		}

		return true;
	}

	public static boolean isClassFile(String fileExtension) {

		if (EXTENSION_JAVA.equals(fileExtension)
				|| EXTENSION_JSP.equals(fileExtension)
				|| EXTENSION_JS.equals(fileExtension)
				|| EXTENSION_HTML.equals(fileExtension)
				|| EXTENSION_CSS.equals(fileExtension)) {

			return true;
		}

		return false;
	}
}
